
exports.GLFactory = Core.Class.singleton({
	
    classname: 'GLFactory',
    
    initialize: function() {
    
	//	log(NgLogLevel.Info, 'Inside GLFactory::initialize()');
	
	},
	
	getNode: function(position) {
		
        var aNode = new GL2.Node();
        aNode.setPosition(position);
        return aNode;
	},
	
	getSprite: function(position, depth, imagePath, size, anchor,uvs) {
		
		var aSprite = null;
		if (imagePath)
		{
			aSprite = new GL2.Sprite();
		}
		else 
		{
			aSprite = new GL2.Sprite();
		}

        if(position != null)
        {
            aSprite.setPosition(position);
        }
        if(depth)
        {
            aSprite.setDepth(depth);
        }
        if(!anchor)
        {
            anchor = [0, 0];
        }
		if(imagePath)
		{
			aSprite.setImage(imagePath, size, anchor,uvs);
		}
		//return TextureManager.getInstance(imagePath, kTATextureType.kTATextureGL);
        return aSprite;
	},
	
	getText: function(position, depth, text, size, fontSize, hAlign, vAlign, overflowMode, anchor, color) {
		
        var aText = new GL2.Text();
        
        if(GALocalizationHandler.getCurrentSetLanguage() == "en")
	    {
	    	aText.setFontLocation(GL2.Text.FontLocation.Manifest);
			aText.setFontFamily("./Content/Fonts/Spookhouse.ttf");
	    }
		
        aText.setPosition(position);
        if(depth != -100)
            aText.setDepth(depth);
        aText.setText(text);
        aText.setSize(size);
        if(fontSize > 0)
            aText.setFontSize(fontSize);
        if(hAlign != null)
            aText.setHorizontalAlign(hAlign);
        if(vAlign != null)
            aText.setVerticalAlign(vAlign);
        if(overflowMode != null)
            aText.setOverflowMode(overflowMode);
        if(color)
        	aText.setColor(color);
        if(anchor)
        	aText.setAnchor(anchor);	
        return aText;
	},
	
	getTouchTarget: function(position, size, parent, touch) {
		
        var aTarget = new GL2.TouchTarget();
        aTarget.setPosition(position);
        aTarget.setSize(size);
        if(touch!=null)
            aTarget.getTouchEmitter().addListener(parent, touch);
        return aTarget;
	}
	
	
});